<template>
  <div class="askQues">
    <center-border :text="askQues" :show="false" :options="options">
      <div class="content">
        <el-table
          :data="tableData"
          style="width: 100%; height: 100%; overflow: auto"
          header-row-class-name="header-row"
        >
          <el-table-column prop="date" type="index" label="序号" width="80" align="left"></el-table-column>
          <el-table-column prop="Name" label="用户名称" width="180"></el-table-column>
          <el-table-column prop="Question" label="问题描述" show-overflow-tooltip></el-table-column>
          <el-table-column prop="TransTime" label="时间" width="180">
            <template #default="scope">
              {{ parseTime(scope.row.TransTime) }}
            </template>
          </el-table-column>
        </el-table>
      </div>
    </center-border>
  </div>
</template>

<script>
import centerBorder from "./centerBorder.vue";
import { connrequest } from "@/api/firstPage";
import { parseTime } from "@/utils/index.js";


export default {
  name: "latestInquiry",
  components: {
    centerBorder
  },
  data() {
    return {
      libText: "企业智库增长趋势图",
      dSUseText: "本地deepseek调用趋势图",
      askQues: "最新咨询问题",
      options: [
        { value: "选项1", label: "黄金糕" },
        { value: "选项2", label: "双皮奶" },
        { value: "选项3", label: "蚵仔煎" },
        { value: "选项4", label: "龙须面" },
        { value: "选项5", label: "北京烤鸭" }
      ],
      tableData: []
    };
  },
  mounted() {
    this.getChatGPTLog();
  },
  methods: {
    parseTime,
    async getChatGPTLog() {
      const data = {
        Paging: {
          QueryPageNo: 1,
          QueryPageLength: 10
        },
        Filter: {
          UserRole: "admin"
        }
      };
      const res = await connrequest("GetChatGPTLog", data);
      if (res.Status.StatusCode === 0) {
        this.tableData = res.Data;
      }
    }
  }
};
</script>

<style lang="scss" scoped>
.askQues {
  height: 30%;
}

::v-deep .el-table {
  color: #bbb;
  .cell {
    text-align: center; /* 内容居中对齐 */
    line-height: 24px;
  }
  .el-table__cell {
    padding: 5px 0;
  }
  tr {
    background-color: #07253e !important;
  }
  td.el-table__cell,
  th.el-table__cell.is-leaf {
    border-bottom: 1px solid #061f35;
  }
  thead {
    color: #0beaf2;
  }
}
::v-deep .el-table--border::after,
.el-table--group::after,
.el-table::before {
  background-color: transparent;
}
::v-deep .el-table--enable-row-hover .el-table__body tr:hover > td.el-table__cell,
::v-deep .el-table,
::v-deep .el-table__expanded-cell {
  background-color: #07253e;
}
::v-deep .el-table th.el-table__cell {
  background-color: #053557;
}
::v-deep .el-table__row td:first-child {
  color: #5fbbf5 !important;
}
</style>
